package com.css.fxfzfxqh.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum EvaluationObjectEnum {
    WATER_SUPPLY(1,"供水系统"),
    AIR_SUPPLY(2,"供气系统"),
    POWER_SUPPLY(3,"供电系统"),
    TRAFFIC(4,"交通系统"),
    COMMUNICATION(5,"通信系统");

    private final Integer code;
    private final String name;

    public static String getByCode(String evaluationObject) {
        StringBuilder str = new StringBuilder();
        for (String dataSource : evaluationObject.split(",")) {
            int code = Integer.parseInt(dataSource);
            for (EvaluationObjectEnum value : EvaluationObjectEnum.values()) {
                if(code == value.getCode()){
                    str.append(value.getName()+"、");
                }
            }
        }
        return str.substring(0, str.length()-1);
    }
}
